package ioc01;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Author：汤小洋
 * Date：2022-11-22 9:55
 * Description：<描述>
 */
public class Test {
    public static void main(String[] args) {
        // HelloSpring helloSpring = new HelloSpring();

        // 获取IoC容器，读取spring配置文件，初始化Spring上下文
        ApplicationContext ac = new ClassPathXmlApplicationContext("ioc01/applicationContext.xml");

        // 根据id获取bean实例
        // HelloSpring helloSpring = (HelloSpring) ac.getBean("helloSpring");
        // 根据类型获取bean实例
        HelloSpring helloSpring = ac.getBean(HelloSpring.class);

        helloSpring.show();
    }
}
